﻿using System;

namespace MySql.Simple.Mapper.Attributes
{
    /// <summary>
    /// Attribute to specify what column a property in a class should be
    /// saved in.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class PrimaryKeyAttribute : ColumnAttribute
    {
        public PrimaryKeyAttribute()
        {
            Nullable = false;

            AutoIncrement = true;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this column is the primary key.
        /// </summary>
        /// <value><c>true</c> if this column is the primary key; otherwise, <c>false</c>.</value>
        public override bool PrimaryKey
        {
            get
            {
                return true;
            }
            set
            {
                // always true
            }
        }
    }
}